package com.example.sport.service.impl;

import com.baomidou.mybatisplus.core.assist.ISqlRunner;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.example.sport.domain.College;
import com.example.sport.domain.Event;
import com.example.sport.domain.User;
import com.example.sport.mapper.CollegeMapper;
import com.example.sport.service.CollegeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CollegeServiceImpl implements CollegeService {
    @Autowired
    private CollegeMapper collegeMapper;

    @Override
    public College getCollegeInfoByUserId(String userId) {
        return collegeMapper.getCollegeInfoByUserId(userId);
    }

    @Override
    public List<College> getEventByCollegeName(String name) {

//        QueryWrapper<College> queryWrapper = new QueryWrapper();
//        queryWrapper.like(StringUtils.isNotBlank(name), "name", name );
        return collegeMapper.selectListByName(name);

    }

    @Override
    public College getCollegeInfoById(String id) {
        return collegeMapper.selectListById(id);
    }

    @Override
    public int deleteEventById(String eventId) {
        return collegeMapper.deleteById(eventId);
    }

    @Override
    public int updateCollage(College college) {
        return collegeMapper.updateById(college);
    }

    @Override
    public int addCollage(College college) {
        return collegeMapper.insert(college);
    }
}
